<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>

    <title>教务综合管理系统</title>

    <link rel="stylesheet" th:href="@{/asserts/css/signin.css}" />
    <link rel="stylesheet" th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.css}" />
    <link rel="stylesheet" th:href="@{/css/element-ui.css}">


    <style type="text/css">
        .help-block {
            color: red;
        }

    </style>
    
    <style type="text/css">
        .help-block {
            color: red;
        }
body {
    display: -webkit-box;
    display: flex;
    -webkit-box-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    align-items: center;
    height: 100%;
    background-size: cover;
    background-image: url(/edumanagement/asserts/img/img.png); /*背景图位置*/
}
    </style>
</head>

<body>
<div class="bg"></div>
<div class="container">
    <form class="form-signin text-center" action="" id="from" >
<!--        <img class="mb-4" th:src="@{/asserts/img/abb.jpg}" alt="" width="72" height="72"/>-->
        <h1 class="h3 mb-3 font-weight-normal" style="color: white">教务综合管理系统</h1>
        <h1 class="h3 mb-3 font-weight-normal" style="color: white">（学生登录）</h1>
        <label class="sr-only" >Username</label>
        <input type="text" class="form-control" placeholder="用户名"
               id="username"
               name="name"/>
        <label class="sr-only">Password</label>
        <input type="password" class="form-control" placeholder="密码"
               id="password"
               name="pwd"
               style="margin-top: 20px"/>


        <div class="checkbox mb-3">
            <label>
                <!--<input type="checkbox" value="remember-me" name="remember-me" /><span></span>-->
            </label>
        </div>
        <button class="btn btn-lg btn-primary btn-block" type="button"id="sub" @click="login">登录</button>
        <span class="help-block"></span>
        <p class="mt-5 mb-3 text-muted">© 2025-2026</p>
    </form>
</div>

</body>
<script type="text/javascript" th:src="@{/webjars/jquery/1.9.1/jquery.js}"></script>
<script type="text/javascript" th:src="@{/webjars/bootstrap/3.3.7/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/js/Vue.js}"></script>
<script type="text/javascript" th:src="@{/js/element-ui.js}"></script>
<script th:inline="javascript" type="text/javascript">

    var basePath= /*[[${#httpServletRequest.getContextPath()}]]*/'ContextPath' ;

    var a = new Vue({
        el:"#from",
        data:{
            usertype:0,
            url:basePath+"/login"
        },
        methods:{
            login:function () {
                console.log("student");
                $.ajax({
                    url:basePath+"/student/login",
                    type:"post",
                    async:false,
                    data:$("#from").serializeArray(),
                    contentType: 'application/x-www-form-urlencoded',
                    dataType:"json",
                    success:function (result) {
                        if(result == 300){
                            a.prompt()
                        }else if(result == 200){
                            window.location.href =basePath+ "/student/index";
                        }else
                            a.caveat()
                    }
                });
            },
            prompt(){
                this.$notify.info({
                    title: '提示',
                    message: '账号不存在'
                });
            },
            caveat(){
                this.$notify.error({
                    title: '提示',
                    message: '密码错误'
                });
            }

        }
    });

    $(".but").click(function(){
        $(".but").removeClass("active");
        $(this).addClass("active");
        a.usertype = $(this).val();
    });


</script>



</html>